package com.srd.phone.dialog;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.TextView;

import com.shengrongdai.srd.R;

/**
 * 错误提示dialog
 */
public class ErrorAlertDialog extends AlertDialog {

    private TextView tv_alert;
    private TextView tv_cancel;
    private TextView tv_sure;

    private Context mContext;
    private View.OnClickListener mCancel;
    private View.OnClickListener mSure;

    protected ErrorAlertDialog(Context context) {
        super(context);
        mContext = context;
    }

    public ErrorAlertDialog(Context context, View.OnClickListener cancel, View.OnClickListener sure) {
        this(context);
        mCancel = cancel;
        mSure = sure;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_error_alert);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

        tv_alert = (TextView) findViewById(R.id.tv_alert);
        tv_cancel = (TextView) findViewById(R.id.tv_cancel);
        tv_cancel.setOnClickListener(mCancel);
        tv_sure = (TextView) findViewById(R.id.tv_sure);
        tv_sure.setOnClickListener(mSure);
    }

    public void setText(String value) {
        tv_alert.setText(value);
    }
}
